<template>
  <el-dialog
    :title="title"
    :close-on-click-modal="false"
    :visible.sync="visible"
    :before-close="cancel"
    class="JNPF-dialog JNPF-dialog_center"
    lock-scroll
    width="55%"
  >
    <el-row :gutter="15" class="">
      <el-form
        ref="elForm"
        :model="dataForm"
        :rules="rules"
        label-width="125px"
      >

      <el-col :span="12">
          <el-form-item label="所属学院" prop="FBILLNO">
            <el-select v-model="dataForm.FBILLNO" placeholder="请选择" :disabled="$store.getters.userInfo.manufacturer">
              <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="所属专业" prop="FBILLSTATE">
            <el-select v-model="dataForm.FBILLSTATE" placeholder="请选择" :disabled="$store.getters.userInfo.manufacturer">
              <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="周别" prop="FWEEK">
            <el-select v-model="dataForm.FWEEK" placeholder="请选择" :disabled="$store.getters.userInfo.manufacturer">
              <el-option
                  v-for="item in options3"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="课节名称" prop="FBRAND">
            <el-select v-model="dataForm.FBRAND" placeholder="请选择" :disabled="$store.getters.userInfo.manufacturer">
              <el-option
                  v-for="item in options4"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item class="required" label="开始时间" prop="FBEGTIME">
            <el-input
              v-model="dataForm.FBEGTIME"
              placeholder="请输入"
              clearable
              :style="{ width: '100%' }"
            >
            </el-input>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item class="required" label="结束时间" prop="FENDTIME">
            <el-input
              v-model="dataForm.FENDTIME"
              placeholder="请输入"
              clearable
              :style="{ width: '100%' }"
            >
            </el-input>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="课程名称" prop="FBILLNAME">
            <el-select v-model="dataForm.FBILLNAME" placeholder="请选择" :disabled="$store.getters.userInfo.manufacturer">
              <el-option
                  v-for="item in options7"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="场地名称" prop="FPOINT">
            <el-select v-model="dataForm.FPOINT" placeholder="请选择" :disabled="$store.getters.userInfo.manufacturer">
              <el-option
                  v-for="item in options5"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="授课教师" prop="FTEACH">
            <el-select v-model="dataForm.FTEACH" placeholder="请选择" :disabled="$store.getters.userInfo.manufacturer">
              <el-option
                  v-for="item in options6"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="是否显示">
            <el-radio-group v-model="dataForm.FVISIBLE">
              <el-radio :label="1">否</el-radio>
              <el-radio :label="2">是</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>

        <el-col :span="24">
          <el-form-item label="备注信息">
            <el-input
              v-model="dataForm.FMEMO"
              placeholder="请输入"
              clearable
              :style="{ width: '100%' }"
            >
            </el-input>
          </el-form-item>
        </el-col>

      </el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
      <el-button @click="cancel">取 消</el-button>
      <el-button  v-if="insertorupdate" type="primary" v-loading="loading">确 定</el-button>
      <el-button v-else type="primary"  v-loading="loading">修 改</el-button>
    </span>
  </el-dialog>
</template>
<script>
import jnpf from "@/utils/jnpf"
export default {
  props: {
    parelist: {
      type: Array,
      default: []
    },
  },
  data() {
    return {
        title:"新增",
        dataForm:{
          FBILLNO: "化学与材料科学学院",
          FBILLSTATE: "化学系",
          FBILLNAME: "综合化学实验1",
          FPOINT:"奉1教楼101",
          FTIME:"09:00~11:00",
          FWEEK: "周一",
          FBRAND: "第一节",
          FBEGTIME: "09:00",
          FENDTIME: "10:30",
          FTEACH: "秦始皇",
          FVISIBLE:2,
          FMEMO: ""
        },
        rules: {
          FCATNO: [
                { required: true, message: '请输入年级编号', trigger: 'blur' },
            ],
            FCATNAME: [
                { required: true, message: '请输入年级名称', trigger: 'blur' },
            ],
        },
      fvisiblelist:[
        {id:"1",fullName:"是"},
        {id:"2",fullName:"否"},
      ],

      options1: [{
          value: 'L001',
          label: '化学与材料科学学院'
        }, {
          value: 'L002',
          label: '生命科学学院'
        }],

        options2: [{
          value: 'L001',
          label: '化学系'
        }, {
          value: 'L002',
          label: '化工与材料系'
        }, {
          value: 'L003',
          label: '分析测试中心'
        }, {
          value: 'L004',
          label: '生物科学'
        }],

        options3: [{
          value: 'L001',
          label: '周一'
        }, {
          value: 'L002',
          label: '周二'
        }, {
          value: 'L003',
          label: '周三'
        }, {
          value: 'L004',
          label: '周四'
        }, {
          value: 'L004',
          label: '周五'
        }],

        options4: [{
          value: 'L001',
          label: '第一节'
        }, {
          value: 'L002',
          label: '第二节'
        }, {
          value: 'L003',
          label: '第三节'
        }, {
          value: 'L004',
          label: '第四节'
        }],

        options5: [{
          value: 'L001',
          label: '奉1教楼101'
        }, {
          value: 'L002',
          label: '奉1教楼102'
        }, {
          value: 'L003',
          label: '奉综教楼201'
        }, {
          value: 'L004',
          label: '奉综教楼202'
        }],

        options6: [{
          value: 'L001',
          label: '秦始皇'
        }, {
          value: 'L002',
          label: '汉武帝'
        }, {
          value: 'L003',
          label: '唐太宗'
        }, {
          value: 'L004',
          label: '宋太祖'
        }],

        options7: [{
          value: 'L001',
          label: '综合化学实验1'
        }, {
          value: 'L002',
          label: '综合化学实验2'
        }, {
          value: 'L003',
          label: '化工基础实验'
        }, {
          value: 'L004',
          label: '仪器分析实验'
        }],

      loading:false,
      visible:false,
      insertorupdate:true
    };
  },
  created() {
  },
  mounted() {},
  methods: {
    //
    init(id){
      this.dataForm.FCATNO= id || ''
        if(this.dataForm.FCATNO)
        {
            this.title="修改"
           this.insertorupdate=false;
        }
        else
        {
          this.insertorupdate=true;
            this.title="新增";
        }
        this.visible=true;
    },
    //
    cancel(){
        this.$refs.elForm.resetFields();
        this.visible=false;
    },
  },
};
</script>
